cr	equ	0dh
lf	equ	0ah
	org	100h
Start:	jmp	Begin
Msg1	db	'Vvedite chislo i najmite Enter:', cr, lf, '$'
Msg2	db	'Vvedite trehznachnie chisla, razdelennie probelom i najmite Enter:', cr, lf, '$'
MsgErr	db	'Oshibka!!!', cr, lf, '$'
NumbArr	times	10	dw	0
IndArr	dw	0
MStr1	db	81
LStr1   db	0
StrNumb1 times	81	db	0
MStr2	db	81
LStr2   db	0
StrNumb2 times	81	db	0
Begin:
	mov	ah,09h
	mov	dx,Msg1
	int	21h
	mov	ah,0ah
	mov	dx,MStr1
	int	21h
	mov	ah,02h
	mov	dl,0ah
	int	21h
	cmp	[LStr1],byte 0
	jz	.Err

 	xor	ax,ax
	xor	bx,bx
	xor	cx,cx
	xor	dx,dx
	xor	si,si
	mov	cl,[LStr1]
	mov	bl,10
.L1:	mov	dl,[StrNumb1+si]
	inc	si
	cmp	dl,39h
	ja	.Err
	cmp	dl,30h
	jb	.Err
	cmp	dl,30h
	jne	.M1
	cmp	si,1
	je	.Err
.M1:	mul	bl
	sub	dl,30h
	add	al,dl
	loop .L1
	mov	[NumbArr],ax
	mov	[IndArr],word 2

	mov	ah,09h
	mov	dx,Msg2
	int	21h
	mov	ah,0ah
	mov	dx,MStr2
	int	21h
	mov	ah,02h
	mov	dl,0ah
	int	21h
	cmp	[LStr2],byte 0
	jz	.Err

  	xor	ax,ax
	xor	bx,bx
	xor	cx,cx
	xor	dx,dx
	xor	si,si
	xor	di,di
	mov	cl,[LStr2]
	mov	bl,10
.L2:	mov	dl,[StrNumb2+si]
	inc	si
	cmp	dl,39h
	ja	.Err
	cmp	dl,30h
	jb	.M2
	cmp	dl,30h
	jne	.M4
	cmp	di,0
	je	.Err
.M4:	mul	bl
	sub	dl,30h
	add	al,dl
	inc	di
	jmp	.M3
.M2:	cmp	dl,20h
	jne	.Err
	cmp	di,3
	jne	.Err
	mov	di,[IndArr]
	mov	[NumbArr+di],ax
	add	di,2
	mov	[IndArr],di
	xor	ax,ax
 	xor	di,di
.M3:	loop .L2
 	xor	di,di
	mov	di,[IndArr]
	mov	[NumbArr+di],ax
	add	di,2

	mov	bx,10
.M5:	sub	di,2
	mov	ax,[NumbArr+di]
	xor	cx,cx
.M7:	xor	dx,dx
	div	bx
	push	dx
	inc	cx
	cmp	ax,0
	jne	.M7
.L3:    pop	ax
	add	al,30h
	mov	ah,02h
	mov	dl,al
	int	21h
	loop	.L3
	mov	ah,02h
	mov	dl,20h
	int	21h
	cmp	di,0
	ja	.M5

	mov	ah,02h
	mov	dl,cr
	int	21h
	mov	dl,lf
	int	21h

	mov	di,[IndArr]
	add	di,2
.M6:	sub	di,2
	mov	bx,[NumbArr+di]
	mov	cx,16
.L4:	mov	dx,0
	rcl	bx,1
	adc	dl,30h
	mov	ah,02h
	int	21h
	loop	.L4
	mov	ah,02h
	mov	dl,20h
	int	21h
	cmp	di,0
	ja	.M6
	jmp	.Exit

.Err:	mov	ah,09h
	mov	dx,MsgErr
	int	21h
.Exit:	mov	ax,4c00h
	int	21h
